package com.test.kf21th02.service.impl;

import com.test.kf21th02.model.CategoryDTO;
import com.test.kf21th02.model.News;
import com.test.kf21th02.mapper.NewsMapper;
import com.test.kf21th02.service.INewsService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author zsy
 * @since 2025-11-04
 */
@Service
public class NewsServiceImpl extends ServiceImpl<NewsMapper, News> implements INewsService {

    @Autowired
    private NewsMapper newsMapper;
    @Override
    public List<CategoryDTO> queryAll(CategoryDTO dto) {
        return newsMapper.queryAll(dto);
    }

    @Override
    public int saveNewsCategory(CategoryDTO dto) {
        return newsMapper.saveNewsCategory(dto);
    }

    @Override
    public int updateNewsCategory(CategoryDTO dto) {
        return newsMapper.updateNewsCategory(dto);
    }

    @Override
    public int deleteNewsCategory(CategoryDTO dto) {
        return newsMapper.deleteNewsCategory(dto);
    }

    @Override
    public CategoryDTO selectByCategoryAndNewsId(CategoryDTO dto) {
        return newsMapper.selectByCategoryAndNewsId(dto);
    }
}
